package com.bbc.core.assertion;

import cn.hutool.core.util.ArrayUtil;
import com.bbc.core.exception.BaseException;
import com.bbc.core.exception.WrapMessageException;
import java.text.MessageFormat;
import java.util.Collection;
import java.util.Map;
import java.util.function.Supplier;

public interface Assert {
   BaseException newException(Object... var1);

   BaseException newException(Throwable var1, Object... var2);

   default BaseException newExceptionWithMsg(String errMsg, Object... args) {
      if (args != null && args.length > 0) {
         errMsg = MessageFormat.format(errMsg, args);
      }

      WrapMessageException e = new WrapMessageException(errMsg);
      throw this.newException(e, args);
   }

   default BaseException newExceptionWithMsg(String errMsg, Throwable t, Object... args) {
      if (!ArrayUtil.isEmpty(args)) {
         errMsg = MessageFormat.format(errMsg, args);
      }

      WrapMessageException e = new WrapMessageException(errMsg, t);
      throw this.newException(e, args);
   }

   default void assertNotNull(Object obj) {
      if (obj == null) {
         throw this.newException();
      }
   }

   default void assertNotNull(Object obj, Object... args) {
      if (obj == null) {
         throw this.newException(args);
      }
   }

   default void assertNotNullWithMsg(Object obj, String errMsg) {
      if (obj == null) {
         throw this.newExceptionWithMsg(errMsg);
      }
   }

   default void assertNotNullWithMsg(Object obj, String errMsg, Object... args) {
      if (obj == null) {
         throw this.newExceptionWithMsg(errMsg, args);
      }
   }

   default void assertNotNullWithMsg(Object obj, Supplier<String> errMsg) {
      if (obj == null) {
         throw this.newExceptionWithMsg((String)errMsg.get());
      }
   }

   default void assertNotNullWithMsg(Object obj, Supplier<String> errMsg, Object... args) {
      if (obj == null) {
         throw this.newExceptionWithMsg((String)errMsg.get(), args);
      }
   }

   default void assertNotEmpty(String str) {
      if (null == str || "".equals(str.trim())) {
         throw this.newException();
      }
   }

   default void assertNotEmpty(String str, Object... args) {
      if (str == null || "".equals(str.trim())) {
         throw this.newException(args);
      }
   }

   default void assertNotEmptyWithMsg(String str, String errMsg) {
      if (null == str || "".equals(str.trim())) {
         throw this.newExceptionWithMsg(errMsg);
      }
   }

   default void assertNotEmptyWithMsg(String str, String errMsg, Object... args) {
      if (str == null || "".equals(str.trim())) {
         throw this.newExceptionWithMsg(errMsg, args);
      }
   }

   default void assertNotEmpty(Object[] arrays) {
      if (arrays == null || arrays.length == 0) {
         throw this.newException();
      }
   }

   default void assertNotEmpty(Object[] arrays, Object... args) {
      if (arrays == null || arrays.length == 0) {
         throw this.newException(args);
      }
   }

   default void assertNotEmptyWithMsg(Object[] arrays, String errMsg) {
      if (arrays == null || arrays.length == 0) {
         throw this.newExceptionWithMsg(errMsg);
      }
   }

   default void assertNotEmptyWithMsg(Object[] arrays, String errMsg, Object... args) {
      if (arrays == null || arrays.length == 0) {
         throw this.newExceptionWithMsg(errMsg, args);
      }
   }

   default void assertNotEmptyWithMsg(Object[] arrays, Supplier<String> errMsg) {
      if (arrays == null || arrays.length == 0) {
         throw this.newExceptionWithMsg((String)errMsg.get());
      }
   }

   default void assertNotEmptyWithMsg(Object[] arrays, Supplier<String> errMsg, Object... args) {
      if (arrays == null || arrays.length == 0) {
         throw this.newExceptionWithMsg((String)errMsg.get(), args);
      }
   }

   default void assertNotEmpty(Collection<?> c) {
      if (c == null || c.isEmpty()) {
         throw this.newException();
      }
   }

   default void assertNotEmpty(Collection<?> c, Object... args) {
      if (c == null || c.isEmpty()) {
         throw this.newException(args);
      }
   }

   default void assertNotEmptyWithMsg(Collection<?> c, String errMsg) {
      if (c == null || c.isEmpty()) {
         throw this.newExceptionWithMsg(errMsg);
      }
   }

   default void assertNotEmptyWithMsg(Collection<?> c, String errMsg, Object... args) {
      if (c == null || c.isEmpty()) {
         throw this.newExceptionWithMsg(errMsg, args);
      }
   }

   default void assertNotEmptyWithMsg(Collection<?> c, Supplier<String> errMsg) {
      if (c == null || c.isEmpty()) {
         throw this.newExceptionWithMsg((String)errMsg.get());
      }
   }

   default void assertNotEmptyWithMsg(Collection<?> c, Supplier<String> errMsg, Object... args) {
      if (c == null || c.isEmpty()) {
         throw this.newExceptionWithMsg((String)errMsg.get(), args);
      }
   }

   default void assertNotEmpty(Map<?, ?> map) {
      if (map == null || map.isEmpty()) {
         throw this.newException();
      }
   }

   default void assertNotEmpty(Map<?, ?> map, Object... args) {
      if (map == null || map.isEmpty()) {
         throw this.newException(args);
      }
   }

   default void assertNotEmptyWithMsg(Map<?, ?> map, String errMsg) {
      if (map == null || map.isEmpty()) {
         throw this.newExceptionWithMsg(errMsg);
      }
   }

   default void assertNotEmptyWithMsg(Map<?, ?> map, String errMsg, Object... args) {
      if (map == null || map.isEmpty()) {
         throw this.newExceptionWithMsg(errMsg, args);
      }
   }

   default void assertNotEmptyWithMsg(Map<?, ?> map, Supplier<String> errMsg) {
      if (map == null || map.isEmpty()) {
         throw this.newExceptionWithMsg((String)errMsg.get());
      }
   }

   default void assertNotEmptyWithMsg(Map<?, ?> map, Supplier<String> errMsg, Object... args) {
      if (map == null || map.isEmpty()) {
         throw this.newExceptionWithMsg((String)errMsg.get(), args);
      }
   }

   default void assertIsFalse(boolean expression) {
      if (expression) {
         throw this.newException();
      }
   }

   default void assertIsFalse(boolean expression, Object... args) {
      if (expression) {
         throw this.newException(args);
      }
   }

   default void assertIsFalseWithMsg(boolean expression, String errMsg) {
      if (expression) {
         throw this.newExceptionWithMsg(errMsg);
      }
   }

   default void assertIsFalseWithMsg(boolean expression, String errMsg, Object... args) {
      if (expression) {
         throw this.newExceptionWithMsg(errMsg, args);
      }
   }

   default void assertIsFalseWithMsg(boolean expression, Supplier<String> errMsg) {
      if (expression) {
         throw this.newExceptionWithMsg((String)errMsg.get());
      }
   }

   default void assertIsFalseWithMsg(boolean expression, Supplier<String> errMsg, Object... args) {
      if (expression) {
         throw this.newExceptionWithMsg((String)errMsg.get(), args);
      }
   }

   default void assertIsTrue(boolean expression) {
      if (!expression) {
         throw this.newException();
      }
   }

   default void assertIsTrue(boolean expression, Object... args) {
      if (!expression) {
         throw this.newException(args);
      }
   }

   default void assertIsTrueWithMsg(boolean expression, String errMsg) {
      if (!expression) {
         throw this.newExceptionWithMsg(errMsg);
      }
   }

   default void assertIsTrueWithMsg(boolean expression, String errMsg, Object... args) {
      if (!expression) {
         throw this.newExceptionWithMsg(errMsg, args);
      }
   }

   default void assertIsTrueWithMsg(boolean expression, Supplier<String> errMsg) {
      if (!expression) {
         throw this.newExceptionWithMsg((String)errMsg.get());
      }
   }

   default void assertIsTrueWithMsg(boolean expression, Supplier<String> errMsg, Object... args) {
      if (!expression) {
         throw this.newExceptionWithMsg((String)errMsg.get(), args);
      }
   }

   default void assertIsNull(Object obj) {
      if (obj != null) {
         throw this.newException();
      }
   }

   default void assertIsNull(Object obj, Object... args) {
      if (obj != null) {
         throw this.newException(args);
      }
   }

   default void assertIsNullWithMsg(Object obj, String errMsg) {
      if (obj != null) {
         throw this.newExceptionWithMsg(errMsg);
      }
   }

   default void assertIsNullWithMsg(Object obj, String errMsg, Object... args) {
      if (obj != null) {
         throw this.newExceptionWithMsg(errMsg, args);
      }
   }

   default void assertIsNullWithMsg(Object obj, Supplier<String> errMsg) {
      if (obj != null) {
         throw this.newExceptionWithMsg((String)errMsg.get());
      }
   }

   default void assertIsNullWithMsg(Object obj, Supplier<String> errMsg, Object... args) {
      if (obj != null) {
         throw this.newExceptionWithMsg((String)errMsg.get(), args);
      }
   }

   default void assertEquals(Object o1, Object o2) {
      if (o1 != o2) {
         if (o1 == null || !o1.equals(o2)) {
            throw this.newException();
         }
      }
   }

   default void assertEquals(Object o1, Object o2, Object... args) {
      if (o1 != o2) {
         if (o1 == null || !o1.equals(o2)) {
            throw this.newException(args);
         }
      }
   }

   default void assertEqualsWithMsg(Object o1, Object o2, String errMsg) {
      if (o1 != o2) {
         if (o1 == null || !o1.equals(o2)) {
            throw this.newExceptionWithMsg(errMsg);
         }
      }
   }

   default void assertEqualsWithMsg(Object o1, Object o2, String errMsg, Object... args) {
      if (o1 != o2) {
         if (o1 == null || !o1.equals(o2)) {
            throw this.newExceptionWithMsg(errMsg, args);
         }
      }
   }

   default void assertEqualsWithMsg(Object o1, Object o2, Supplier<String> errMsg) {
      if (o1 != o2) {
         if (o1 == null || !o1.equals(o2)) {
            throw this.newExceptionWithMsg((String)errMsg.get());
         }
      }
   }

   default void assertEqualsWithMsg(Object o1, Object o2, Supplier<String> errMsg, Object... args) {
      if (o1 != o2) {
         if (o1 == null || !o1.equals(o2)) {
            throw this.newExceptionWithMsg((String)errMsg.get(), args);
         }
      }
   }

   default void assertFail() {
      throw this.newException();
   }

   default void assertFail(Object... args) {
      throw this.newException(args);
   }

   default void assertFail(Throwable t) {
      throw this.newException(t);
   }

   default void assertFail(Throwable t, Object... args) {
      throw this.newException(t, args);
   }

   default void assertFailWithMsg(String errMsg) {
      throw this.newExceptionWithMsg(errMsg);
   }

   default void assertFailWithMsg(String errMsg, Object... args) {
      throw this.newExceptionWithMsg(errMsg, args);
   }

   default void assertFailWithMsg(String errMsg, Throwable t) {
      throw this.newExceptionWithMsg(errMsg, t);
   }

   default void assertFailWithMsg(String errMsg, Throwable t, Object... args) {
      throw this.newExceptionWithMsg(errMsg, t, args);
   }

   default void assertFailWithMsg(Supplier<String> errMsg) {
      throw this.newExceptionWithMsg((String)errMsg.get());
   }

   default void assertFailWithMsg(Supplier<String> errMsg, Object... args) {
      throw this.newExceptionWithMsg((String)errMsg.get(), args);
   }

   default void assertFailWithMsg(Supplier<String> errMsg, Throwable t) {
      throw this.newExceptionWithMsg((String)errMsg.get(), t);
   }

   default void assertFailWithMsg(Supplier<String> errMsg, Throwable t, Object... args) {
      throw this.newExceptionWithMsg((String)errMsg.get(), t, args);
   }
}
